//
//  DYJSerialHeaderTableViewCell.m
//  Piece
//
//  Created by dllo on 16/6/8.
//  Copyright © 2016年 Northeast Dianli University. All rights reserved.
//

#import "DYJSerialHeaderTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation DYJSerialHeaderTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.userImageView.layer.masksToBounds = YES;
    self.userImageView.layer.cornerRadius = 20;
    self.userImageView.contentMode = UIViewContentModeScaleAspectFill;
    
    self.userNameLabel.font = [UIFont systemFontOfSize:13];
    self.userNameLabel.textColor = [UIColor colorWithRed:0.14 green:0.63 blue:0.91 alpha:1.00];
    
    self.userIntroduceLabel.font = [UIFont systemFontOfSize:15];
    self.userIntroduceLabel.textColor = [UIColor colorWithRed:0.75 green:0.75 blue:0.75 alpha:1.00];
    
    self.dateLabel.font = [UIFont systemFontOfSize:11];
    self.dateLabel.textColor = [UIColor colorWithRed:0.80 green:0.83 blue:0.86 alpha:1.00];
    self.dateLabel.textAlignment = 2;

    
    self.titleLabel.font = [UIFont systemFontOfSize:17];
    self.titleLabel.numberOfLines = 0;
}
- (void)setModel:(DYJSerialContentModel *)model
{
    if (_model != model) {
        _model = model;
        self.userNameLabel.text = model.authorModel.user_name;
        self.userIntroduceLabel.text = model.authorModel.desc;
        self.titleLabel.text = model.title;
        [self.userImageView sd_setImageWithURL:[NSURL URLWithString:model.authorModel.web_url] placeholderImage:[UIImage imageNamed:@"xph"]];
        
        NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init] ;
        [inputFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
        NSDate *inputDate = [inputFormatter dateFromString:model.last_update_date];
        NSDateFormatter * outputFormatter = [[NSDateFormatter alloc]init];
        [outputFormatter setDateFormat:@"MMM dd,yyyy.EEE"];
        NSString *str = [outputFormatter stringFromDate:inputDate];
        self.dateLabel.text = str;

    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
